package com.smart.seckilldemo.controller;

import com.smart.seckilldemo.commons.result.ResponseResult;
import com.smart.seckilldemo.service.OrderService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;

/**
 * @author mtl
 */
@Controller
@RequestMapping("/order")
public class OrderController {

    @Resource
    OrderService orderService;

    /**
     * 查询订单信息
     * @param orderId
     * @return
     */
    @ResponseBody
    @RequestMapping(value = "/detail",method = RequestMethod.GET)
    public ResponseResult detail(Long orderId){
        return ResponseResult.success(orderService.detail(orderId));
    }

    /**
     * 获取该用户的全部商品
     * @param
     * @return
     */
    @ResponseBody
    @RequestMapping("/findOrderByuId")
    public ResponseResult findOrderByuId(Long userId){
        return ResponseResult.success(orderService.findOrderByUserId(userId));
    }

}
